package com.ihrm.employee.service;


import com.ihrm.domain.employee.EmployeeTransferPosition;
import com.ihrm.employee.dao.TransferPositionDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class TransferPositionService {

    @Autowired
    private TransferPositionDao transferPositionDao;
    
    public EmployeeTransferPosition findById(String uid,Integer status){
    
        EmployeeTransferPosition transferPosition = transferPositionDao.findByUserId(uid);
        if(status!=null&&transferPosition!=null){
            if(transferPosition.getEstatus()!=(int)status ){
                transferPosition=null;
            }
        }
        return transferPosition;
    }
    
    public void save(EmployeeTransferPosition transferPosition){
        transferPosition.setCreateTime(new Date());
        transferPosition.setEstatus(1);//未执行
        transferPositionDao.save(transferPosition);
    }
    
    
}
